<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@page import="com.lmpop.trade.ti_gift.*"%>
<%@page import="java.util.*"%>
<%@page import="com.lmpop.trade.ti_goods.*"%>
<%@page import="com.lmpop.trade.ts_category.Ts_categoryInfo"%>
<html>
	<head>

		<title>修改礼品信息</title>
		<link href="/program/admin/index/css/style.css" rel="stylesheet"
			type="text/css">
		<script type="text/javascript" src="index.js"></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/engine.js'></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/util.js'></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/interface/Ts_categoryInfo.js'></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/interface/Ti_goodsInfo.js'></script>
				<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ti_giftInfo.js'></script> 
		<script type="text/javascript"
			src="/program/admin/goods/s_classify.js"></script>
	</head>

	<body>

		<%
			String gift_id = "";
			if (request.getParameter("gift_id") != null)
				gift_id = request.getParameter("gift_id");
			Ti_giftInfo ti_giftInfo = new Ti_giftInfo();
			List list = ti_giftInfo.getListByPk(gift_id);
			Hashtable map = new Hashtable();
			if (list != null && list.size() > 0)
				map = (Hashtable) list.get(0);

			String gift_name = "", gift_type = "", cust_id="",good_id = "", gift_desc = "",class_attr = "", gift_no = "", stock_num = "", state_code = "", rsrv_str1 = "", rsrv_str2 = "", rsrv_str3 = "", in_date = "", user_id = "";
			String[] str = new String[2];
			if (map.get("gift_name") != null)
				gift_name = map.get("gift_name").toString();
			if (map.get("cust_id") != null)
				cust_id = map.get("cust_id").toString();
				
			if (map.get("gift_type") != null)
				gift_type = map.get("gift_type").toString();
			if (map.get("good_id") != null)
				good_id = map.get("good_id").toString();
			if (map.get("gift_desc") != null)
				gift_desc = map.get("gift_desc").toString();
			if (map.get("class_attr") != null)
				class_attr = map.get("class_attr").toString();
			if (map.get("gift_no") != null)
				gift_no = map.get("gift_no").toString();
			if (map.get("stock_num") != null)
				stock_num = map.get("stock_num").toString();
			if (map.get("state_code") != null)
				state_code = map.get("state_code").toString();
			if (map.get("in_date") != null)
				in_date = map.get("in_date").toString();
			if (map.get("user_id") != null)
				user_id = map.get("user_id").toString();
			

			String session_user_id = "";
			if (session.getAttribute("session_user_id") != null) {
				session_user_id = session.getAttribute("session_user_id")
						.toString();
			}
			Ts_categoryInfo ts_categoryInfo = new Ts_categoryInfo();
			Map catMap = ts_categoryInfo.getCatClassMap("2");
			if (!class_attr.equals("")) {
					String catIds[] = class_attr.split("\\|");
					int i=0;
					for (String catId : catIds) {
						if (catMap != null) {
							if (catMap.get(catId) != null) {
								str[i]= catMap.get(catId).toString();
								i++;
							}

						}
					}
				}
		%>

		<h1>
			修改礼品信息
		</h1>
		<form action="/doTradeReg.do" method="post" name="updateForm">
			<table width="100%" cellpadding="0" cellspacing="1" border="0"
				class="listtab">

				<tr>
					<td align="right" width="10%">
						礼品名称
						<font color="red">*</font>
					</td>
					<td>
						<input name="gift_name" id="gift_name" size="20" maxlength="100	"
							value="<%=gift_name%>" type="text" />
					</td>
				</tr>

				<tr  style="display:none">
					<td align="right" width="10%">
						礼品类型
						<font color="red">*</font>
					</td>
					<td >
								<input  id="gift_type1" name="gift_type" value="1"  type="radio" checked />礼品
								 
					</td>
				</tr>

				<tr>
					<td align="right" width="10%">
						礼品分类
						<font color="red">*</font>
					</td>
					<td>
						<select name="sort1" id="sort1"
							onclick="setSecondClass(this.value);">
							<option value="">
								<%=str[0] %>
							</option>
						</select>
						<select name="sort2" id="sort2"
							onclick="setTherdClass(this.value);">
							<option value="">
								<%=str[1] %>
							</option>
						</select>
					</td>
				</tr>
 
			<tr>
				<td align="right" width="20%">
					礼品图片：		
				</td>
				<td  width="80%">
					<jsp:include page="/program/inc/uploadImgInc.jsp">
						 <jsp:param name="attach_root_id" value="<%=gift_id%>" />
					</jsp:include>
	
				
				</td>
			</tr>
		
				<tr>
						<td align="right" width="20%">
							详细说明：
						</td>
						<td>
						<textarea name="gift_desc" id="gift_desc" cols="50" rows="10"><%=gift_desc%></textarea>
						</td>
				</tr>
		
				<tr style="display:none">
					<td align="right" width="10%">
						当前库存
						<font color="red">*</font>
					</td>
					<td>
						<input name="stock_num" id="stock_num" size="20" maxlength="20" readonly="readonly"
							value="<%=stock_num%>" type="text" onKeyUp="if(isNaN(value))this.value=''"/>
					</td>
				</tr>

				 

			</table>

			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td align="center">
						<input type="hidden" name="bpm_id" value="0403" />
						<input name="gift_type" id="gift_type" value="<%=gift_type%>"
							type="hidden" />
						<input name="cust_id" id="cust_id" value="<%=cust_id%>"
							type="hidden" />
						<input name="class_attr" id="class_attr" type="hidden" value="<%=class_attr %>"/>
						<input name="state_code" id="state_code" value="<%=state_code%>"
							type="hidden" />
						<input name="user_id" id="user_id" value="<%=session_user_id%>"
							type="hidden" />
						<input type="hidden" name="gift_id" value="<%=gift_id%>" />
						<input type="button" class="buttoncss" name="tradeSub" value="提交"
							onclick="return checkSub('updateForm');" />
						&nbsp;&nbsp;
						<input type="button" class="buttoncss" name="tradeRut" value="返回"
							onclick="window.location.href='giftindex.jsp?cust_id=<%=cust_id%>';" />
					</td>
				</tr>
			</table>
		</form>
	</body>
<script type="text/javascript">
	<%
		if(gift_type.equals("1")){%>
			isShow(1);
		<%}else{%>
		isShow(2);
	<%}%>
</script>
</html>
